package com.magic.item.controller;

import com.magic.item.pojo.Admin;
import com.magic.item.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author lan.jianyuan
 * @create 2021-03-08-15:55
 */
@Controller
public class AdminController {
    @Autowired
    private AdminService adminService;
    @PostMapping("login")
    public ResponseEntity<Admin> adminLogin(@RequestBody Admin admin) {
        Admin admin1 = this.adminService.adminLogin(admin);
        if (admin1 == null) {
            return ResponseEntity.notFound().build();
        }
        return ResponseEntity.ok(admin1);
    }
}
